package com.ruoyi.mdm.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mdm.mapper.ChannelWeightMapper;
import com.ruoyi.mdm.domain.ChannelWeight;
import com.ruoyi.mdm.service.IChannelWeightService;

/**
 * 渠道权重Service业务层处理
 *
 * @author shiseido
 * @date 2025-02-28
 */
@Service
public class ChannelWeightServiceImpl implements IChannelWeightService {
    @Autowired
    private ChannelWeightMapper channelWeightMapper;

    /**
     * 查询渠道权重
     *
     * @param id 渠道权重主键
     * @return 渠道权重
     */
    @Override
    public ChannelWeight selectChannelWeightById(Long id) {
        return channelWeightMapper.selectChannelWeightById(id);
    }

    /**
     * 查询渠道权重列表
     *
     * @param channelWeight 渠道权重
     * @return 渠道权重
     */
    @Override
    public List<ChannelWeight> selectChannelWeightList(ChannelWeight channelWeight) {
        return channelWeightMapper.selectChannelWeightList(channelWeight);
    }

    /**
     * 新增渠道权重
     *
     * @param channelWeight 渠道权重
     * @return 结果
     */
    @Override
    public int insertChannelWeight(ChannelWeight channelWeight) {
        channelWeight.setCreateTime(DateUtils.getNowDate());
        channelWeight.setUpdateTime(DateUtils.getNowDate());
        return channelWeightMapper.insertChannelWeight(channelWeight);
    }

    /**
     * 修改渠道权重
     *
     * @param channelWeight 渠道权重
     * @return 结果
     */
    @Override
    public int updateChannelWeight(ChannelWeight channelWeight) {
        channelWeight.setUpdateTime(DateUtils.getNowDate());
        return channelWeightMapper.updateChannelWeight(channelWeight);
    }

    /**
     * 删除渠道权重信息
     *
     * @param channelCode 渠道编码
     * @return 结果
     */
    @Override
    public int deleteChannelWeightByChannelCode(String channelCode) {
        return channelWeightMapper.deleteChannelWeightByChannelCode(channelCode);
    }

    /**
     * 批量删除渠道权重
     *
     * @param ids 需要删除的渠道权重主键
     * @return 结果
     */
    @Override
    public int deleteChannelWeightByIds(Long[] ids) {
        return channelWeightMapper.deleteChannelWeightByIds(ids);
    }

    /**
     * 删除渠道权重信息
     *
     * @param id 渠道权重主键
     * @return 结果
     */
    @Override
    public int deleteChannelWeightById(Long id) {
        return channelWeightMapper.deleteChannelWeightById(id);
    }
}
